# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Schnouki <thomas.jost@gmail.com>
# Contributor: devon <admin@patched.biz>

pkgname=dstat
pkgver=0.7.4
pkgrel=5
pkgdesc="A versatile resource statistics tool"
arch=('any')
url="http://dag.wieers.com/home-made/dstat/"
license=('GPL')
depends=('python' 'python-six')
source=(https://github.com/dagwieers/dstat/archive/v${pkgver}.tar.gz
        https://github.com/efexgee/dstat/commit/220a785321b13b6df92a536080aca6ef1cb644ad.patch)
sha512sums=('d100223887ebd83d0fd1259436f39419a85df9002556abcfc8e4195aa63be73d85707dcd5c4fb56a979b29131485dce6e97c177fbfca08dc50bd0f92b15cc6f5'
            '7c5dc03aaa3d9a4f65b47170a99c2d61a4cb007bacae5729ff09bdd569bd7b6fc4048efaceb6a6392561bb2f4bf1a7fc0e31ab6f2624b6edb55071f1baaa9b99')

prepare() {
  cd $pkgname-$pkgver

  patch -Np1 -i "$srcdir"/220a785321b13b6df92a536080aca6ef1cb644ad.patch
}

package() {
  cd $pkgname-$pkgver

  make DESTDIR="$pkgdir" install
  make DESTDIR="$pkgdir" docs

  # Get rid of deprecation warning.
  sed -i "s/import collections/import collections.abc/g" -i "$pkgdir"/usr/bin/dstat
  sed -i "s/collections.Sequence/collections.abc.Sequence/g" -i "$pkgdir"/usr/bin/dstat
}
